package com.zhanghs.contentcenter.common;

import lombok.Builder;
import lombok.Data;

import java.io.Serializable;

/**
 * @Author zhanghongshan
 * @date 2021/10/3 10:05 上午
 */
@Data
@Builder
public class CommonResp<T> implements Serializable {
    private Integer code;
    private String message;
    private T data;
    private static final Integer SUCESS_CODE=0;
    private static final String SUCESS_MESSAGE="success";

    public CommonResp(){}

    public CommonResp(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public  CommonResp<T> success(T data){
        return new CommonResp<>(CommonResp.SUCESS_CODE, CommonResp.SUCESS_MESSAGE, data);
    }
}
